const MyPromise = require('./myPromise');

function p1() {
    return new MyPromise(function (resolve, reject) {
        setTimeout(function () {
            resolve('p1')
        }, 2000)
    })
}

function p2() {
    return new MyPromise(function (resolve, reject) {
        reject('失败')
        // resolve('成功');  
    })
}

p1().then(console.log)

p2().then(value => console.log(value))
    .catch(reason => console.log(reason))